-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add using
and await using
Declarations, SuppressedError, DisposableStack, and AsyncDisposableStack
#3000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
b7b82d5
to
17e0bc0
Compare
I'm not quite sure how to address the remaining esmeta issues. |
Rather than suggest changes here, I've made a PR against this PR's branch: rbuckton#2 |
This last commit adds a few UpdateEmpty calls that aren't strictly necessary, but |
@rbuckton Sorry about that - esmeta is still a little imprecise. You should feel free to write the spec text you want and not worry about esmeta's errors, and we can update esmeta or the ignore file. |
I replaced the |
Please note, I've created rbuckton#3 as a separate PR against this one containing the additional specification changes that would be necessary to support https://github.com/tc39/proposal-async-explicit-resource-management, should it advance to Stage 3. |
I found an issue with the change in e4f2d05 to use an EE to restrict binding patterns, in that it results in an ambiguous parse of I've filed tc39/proposal-explicit-resource-management#152 against the proposal spec, and will update this PR in due time. |
tc39/proposal-explicit-resource-management#152 has merged, and I've amended this PR to match as part of 3044fd9. |
This comment was marked as duplicate.
This comment was marked as duplicate.
spec.html
Outdated
It is a Syntax Error if the BoundNames of |BindingList| contains any duplicate entries. | ||
</li> | ||
<li> | ||
It is a Syntax Error if the goal symbol is |Script| and |UsingDeclaration| is not contained, either directly or indirectly, within a |Block|, |CaseBlock|, |ForStatement|, |ForInOfStatement|, |FunctionBody|, |GeneratorBody|, |AsyncGeneratorBody|, |AsyncFunctionBody|, |ClassStaticBlockBody|, or |ClassBody|. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rbuckton What is an example of a using
contained within a ClassBody
? It can't be directly contained within one, and if indirectly contained, then it would already be directly contained within another production on the list (like ClassStaticBlockBody, FunctionBody, etc). During implementation we found the inclusion of ClassBody in this list confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, ClassBody here is superfluous and should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be addressed by tc39/proposal-explicit-resource-management#220 and rbuckton#6
This now includes the |
Note to implementers: There is a typo in |
This is also missing the consensus change to use |
d9d189a
to
4914a91
Compare
Rebased (twice, to make GitHub happy). Hopefully that fixes the PR in the diff review website. |
Hey! now its significantly easier to read from https://arai-a.github.io/ecma262-compare/?pr=3000 thank you so much!! |
More editorial suggestions at rbuckton#11 |
…nullish Reduce unnecessary Awaits for nullish values in blocks containing `await using`
Add missing 'constructor' definitions
@bakkot, @syg, @michaelficarra: I am hoping to ask for Stage 4 at the May plenary, but this PR still requires reviews from the editors. |
@rbuckton Noted, we'll get to it ASAP. If we don't get to it before the meeting you're welcome to ask for stage 4 pending editor review, and then assuming the committee approves we'll land after we finish review. |
Much appreciated. I'll look into addressing the two merge conflicts next week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m sorry if this has already been covered, but I was curious about one point during the implementation.
1. Else, | ||
1. If _V_ is not an Object, throw a *TypeError* exception. | ||
1. Set _method_ to ? GetDisposeMethod(_V_, _hint_). | ||
1. If _method_ is *undefined*, throw a *TypeError* exception. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do it only check for undefined
and not isCallable
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetDisposeMethod calls GetMethod, which does a IsCallable check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got it, thank you!
<h1>AsyncDisposableStack.prototype.disposeAsync ( )</h1> | ||
<p>When the `disposeAsync` method is called, the following steps are taken:</p> | ||
<emu-alg> | ||
1. Let _asyncDisposableStack_ be the *this* value. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The presence of the slot is checked a few lines below. We want to return a rejected promise in that case, following the principle that functions which return Promises should not synchronously throw.
Disallow using/await using in a switch case/default clause
This PR contains the Stage 3 specification text for Explicit Resource Management.